<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use backend\assets\AppAsset;

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model backend\models\RegisterForm */

$this->title = '注册';
$url = \yii\helpers\Url::toRoute(['get-region']);


$fieldOptions1 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-user form-control-feedback'></span>"
];

$fieldOptions2 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-envelope form-control-feedback'></span>"
];

$fieldOptions3 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-eye-open form-control-feedback'></span>"
];

$fieldOptions4 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-eye-open form-control-feedback'></span>"
];

$fieldOptions5 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-phone form-control-feedback'></span>"
];

$fieldOptions6 = [
    'options' => ['class' => 'form-group has-feedback col-sm-7'],
    'inputTemplate' => "{input}"
];

?>

    <div class="register-box">
        <div class="register-logo">
            <a href="#"><b>后台管理系统</b></a>
        </div>
        <!-- /.register-logo -->
        <div class="register-box-body">
            <p class="register-box-msg"><i class="glyphicon glyphicon-user"></i> 注册新账号</p>
            <?php $form = ActiveForm::begin(['id' => 'register-form']); ?>
            <?= $form
                ->field($model, 'username', $fieldOptions1)
                ->label(false)
                ->textInput(['placeholder' => $model->getAttributeLabel('username')])
            ?>

            <?= $form
                ->field($model, 'mobile', $fieldOptions5)
                ->label(false)
                ->textInput(['placeholder' => $model->getAttributeLabel('mobile')])
            ?>
            <div class="row">
                <?= $form
                    ->field($model, 'register_sms_code', $fieldOptions6)
                    ->label(false)
                    ->textInput(['placeholder' => $model->getAttributeLabel('register_sms_code')])
                ?>
                <?= Html::buttonInput('获取验证码', ['class' => 'form-group has-feedback btn bg-primary col-sm-4', 'name' => 'register-button', 'id' => 'second']) ?>
            </div>

            <?= $form
                ->field($model, 'password', $fieldOptions3)
                ->label(false)
                ->textInput(['placeholder' => $model->getAttributeLabel('password')])
            ?>

            <?= $form
                ->field($model, 'retype_password', $fieldOptions4)
                ->label(false)
                ->textInput(['placeholder' => $model->getAttributeLabel('retype_password')])
            ?>

            <div class="row">
                <div class="col-xs-12">
                    <?= Html::submitButton('注册', ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'register-button']) ?>
                </div>
                <!-- /.col -->
            </div>
            <hr>
            <?= Html::a('我已经有一个账号', '/login', ['class' => 'text-center']) ?>
            <?php ActiveForm::end(); ?>

        </div>
        <!-- /.register-box-body -->
    </div><!-- /.register-box -->
<?= AppAsset::addScript($this, Yii::$app->request->baseUrl . "/js/register-sms-code.js"); ?>